package org.fireflow2.designer.eclipse.commands.datafield;

import org.eclipse.gef.commands.Command;
import org.fireflow2.designer.eclipse.modelwrapper.SubProcessWrapper;
import org.fireflow2.designer.eclipse.modelwrapper.basic.DataFieldWrapper;

public class DeleteDataFieldCommand extends Command {
	DataFieldWrapper dfWrapper = null;
	SubProcessWrapper parent = null;
	int oldIndex = -1;
	
	public DeleteDataFieldCommand(DataFieldWrapper arg0){
		dfWrapper = arg0;
		parent = (SubProcessWrapper)dfWrapper.getParent();
	}
	
	public void execute(){
		oldIndex = parent.deleteChild(dfWrapper);
	}
	
	
	public void redo(){
		parent.deleteChild(dfWrapper);
	}
	
	public void undo(){
		parent.addChild(dfWrapper,oldIndex);
	}	
}
